package de.mp3player.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import de.mp3player.app.App;

public class ControllerPanel extends JPanel{
	
	private JToolBar toolbar;
	
	private JButton play;
	private JButton stop;
	private JButton pause;
	private JButton skipn;
	private JButton skipp;
	private JButton forward;
	private JButton back;
	private JButton record;
	private JButton repeat;
	private JButton shuffle;
	private JButton eject;
	
	public ControllerPanel(){
		this.toolbar = new JToolBar();
		this.play = new JButton(App.makeIcon("/resources/media-playback-start.png"));
		this.stop = new JButton(App.makeIcon("/resources/media-playback-stop.png"));
		this.pause = new JButton(App.makeIcon("/resources/media-playback-pause.png"));
		this.skipn = new JButton(App.makeIcon("/resources/media-skip-forward.png"));
		this.skipp = new JButton(App.makeIcon("/resources/media-skip-backward.png"));
		this.forward = new JButton(App.makeIcon("/resources/media-seek-forward.png"));
		this.back = new JButton(App.makeIcon("/resources/media-seek-backward.png"));
		this.record = new JButton(App.makeIcon("/resources/media-record.png"));
		this.eject = new JButton(App.makeIcon("/resources/media-eject.png"));
		this.repeat = new JButton(App.makeIcon("/resources/media-playlist-repeat.png"));
		this.shuffle = new JButton(App.makeIcon("/resources/media-playlist-shuffle.png"));
		setTooltips();
		initActions();
		buildPanel();
	}
	private void initActions() {
		this.play.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				
				
			}
		});
		this.stop.addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				
				
			}
		});
		
	}
	private void buildPanel(){
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		this.toolbar.add(eject);
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		this.toolbar.add(skipp);
		this.toolbar.add(back);
		this.toolbar.add(play);
		this.toolbar.add(pause);
		this.toolbar.add(stop);
		this.toolbar.add(record);
		this.toolbar.add(forward);
		this.toolbar.add(skipn);
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		this.toolbar.add(repeat);
		this.toolbar.add(shuffle);
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		this.toolbar.add(new JLabel(App.makeIcon("/resources/menubar.png")));
		add(toolbar);
	}
	private void setTooltips(){
		this.play.setToolTipText("Abspielen");
		this.stop.setToolTipText("Stop");
		this.pause.setToolTipText("Pause");
		this.skipn.setToolTipText("Nächstes");
		this.skipp.setToolTipText("Vorhergehendes");
		this.forward.setToolTipText("Vorspulen");
		this.back.setToolTipText("Zurückspulen");
		this.record.setToolTipText("Aufnahme");
		this.repeat.setToolTipText("Playlist wiederholen");
		this.shuffle.setToolTipText("Playliste shufflen");
		this.eject.setToolTipText("CD auswerfen");
	}
}
